<template>
  <!-- 充值-->
  <el-dialog
    v-el-drag-dialog
    :title="title"
    :visible.sync="visible"
    width="60%"
    append-to-body
    @close="reset"
  >
    <el-form ref="dataForm" class="form" label-position="left" label-width="80px">
      <el-form-item label-width="0" class="block">
        <el-input v-model.trim="search.param" style="width: 300px;" placeholder="请输入">
          <el-select slot="prepend" v-model="qtype" style="width: 100px;" placeholder="请选择" @change="change">
            <el-option label="客户电话" value="csmPhone" />
            <el-option label="卡检索" value="cardCode" />
            <el-option label="客户编号" value="csmCode" />
            <el-option label="客户组号" value="groupCode" />
          </el-select>
        </el-input>
        <el-button v-if="isBtn" type="primary" style="margin-left: 10px;" @click="sendMessageCode">{{ btnTxt1 }}</el-button>
        <el-button style="margin-left: 10px;" type="primary" @click="searchTxt">查询</el-button>
      </el-form-item>
      <el-form-item v-if="isCode" label-width="80" label="验证码:">
        <el-input v-model.trim="messageCode" style="width: 235px;" :minlength="6" :maxlength="6" placeholder="请输入" />
      </el-form-item>
    </el-form>
    <el-table
      v-if="qtype === 'csmPhone' || (cradType===11 && qtype === 'groupCode')"
      ref="lbTable"
      :data="tableData"
      border
      class="table-list"
      style="width: 100%; margin-bottom: 10px;"
      @select="dialogCheck"
    >
      <el-table-column
        type="index"
        width="50"
      />
      <el-table-column
        type="selection"
        width="50"
      />
      <el-table-column
        prop="csmCode"
        label="客户编号/组号"
        width="130"
      />
      <el-table-column
        prop="csmCode"
        label="类别"
        width="100"
      >
        <template slot-scope="scoped">
          <div>
            {{ scoped.row.cardOpenStatus ? scoped.row.cardOpenStatus === 1 ? '客户' : scoped.row.cardOpenStatus === 2 ? '客户组' : '' : '' }}
          </div>
        </template>
      </el-table-column>
      <el-table-column
        prop="csmName"
        label="客户名称/组名称"
        width="130"
      />
      <el-table-column
        prop="csmType"
        label="客户/组类型"
        width="100"
      >
        <template slot-scope="scoped">
          <div>
            {{
              scoped.row.cardOpenStatus ? scoped.row.cardOpenStatus === 1 ? scoped.row.csmType?formatColumnMap(customerTypeMap, 'value', scoped.row.csmType, 'desc'):'':
                scoped.row.cardOpenStatus === 2 ? scoped.row.csmType?formatColumnMap(groupTypeList, 'value', scoped.row.csmType, 'desc'):'' : '' : ''

            }}
          </div>
        </template>
      </el-table-column>
      <el-table-column
        prop="orgName"
        label="所属机构"
        width="130"
      />
      <el-table-column
        prop="csmPhone"
        label="联系电话"
        width="130"
      />
    </el-table>

    <div v-if="cradType===11&&isGroup" class="csmInfo">
      <p>
        <span>关联客户信息</span><span>勾选的客户才能使用总公司的充值卡余额，开卡成功，如果客户没有充值卡，自动建立新的充值卡</span>
      </p>
      <lb-table
        ref="groupTable"
        border
        class="group-list"
        highlight-current-row
        element-loading-text="加载中"
        :column="groupData.column"
        :data="groupData.data"
        pagination
        :total="groupData.total"
        :custom-column="false"
        :immediate-fetch="false"
        @select="groupCheck"
        @select-all="groupCheckAll"
        @fetch="groupFetchData"
      />
    </div>

    <div class="item" style="margin-top: 10px;">
      <div class="title">
        <span class="title-icon" />
        <span class="title-text">卡信息</span>
      </div>
      <el-descriptions size="medium">
        <el-descriptions-item label="客户编号/组号">{{ csmInfo.csmCode }}</el-descriptions-item>
        <el-descriptions-item label="客户名称/组名称">{{ csmInfo.csmName }}</el-descriptions-item>
        <el-descriptions-item label="卡号">{{ csmInfo.cardCode }}</el-descriptions-item>
        <el-descriptions-item label="现金卡值">{{ numberFormat1(csmInfo.cashMoney ) +'元' }}</el-descriptions-item>
        <el-descriptions-item label="赠送卡值">{{ numberFormat1(csmInfo.sendMoney) +'元' }}</el-descriptions-item>
        <el-descriptions-item label="卡余额">{{ numberFormat1(csmInfo.cardSurplus) +'元' }}</el-descriptions-item>
        <el-descriptions-item v-if="cradType!==11" label="使用门店">{{ csmInfo.useOrgName }}</el-descriptions-item>
        <el-descriptions-item v-if="cradType!==11" label="信用额度">{{ numberFormat1(csmInfo.cardFreeMoney) +'元' }}</el-descriptions-item>
        <el-descriptions-item v-if="cradType!==11" label="主副卡">{{ csmInfo.isMainCard ? csmInfo.isMainCard === 1 ? '主卡' : csmInfo.isMainCard === 2 ? '副卡' : '' : '' }}</el-descriptions-item>

      </el-descriptions>
      <div v-if="cradType===11">
        <el-form ref="cardForm" :model="query" :inline="true" class="cardForm" label-width="73px">
          <el-form-item label="使用门店:">
            <el-tree-select
              v-model="query.useOrgId"
              :clearable="false"
              :disabled="isAllOrg"
              class="tree-select"
              :popover-width="360"
              :select-params="{
                clearable: false,
                placeholder: '请选择责任机构',
              }"
              :tree-params=" {
                'expand-on-click-node': false,
                'highlight-current': true,
                props:{
                  value:'orgId',
                  label: 'orgName',
                },
                data: treeData
              }"
            />
          </el-form-item>
          <el-form-item label="信用额度:" label-width="73px">
            <el-input-number v-model.trim="query.cardFreeMoney" :precision="2" :controls="false" :min="0" :max="99999999" />元
          </el-form-item>
        </el-form>
      </div>
    </div>
    <!-- 充值 -->
    <div v-if=" cradType===1 " class="item">
      <div class="title">
        <span class="title-icon" />
        <span class="title-text">其他信息</span>
      </div>
      <el-form ref="dataFormCharge" class="form" label-position="right" label-width="120px" :model="temp">
        <el-form-item :rules="!temp.feeCount2?[{ required: true, message: '请输入充值金额', trigger: 'change' }]:[]" label="充值金额:" prop="feeCount1">
          <el-input v-model="temp.feeCount1" :disabled="csmInfo.isMainCard === 2" placeholder="请输入" maxlength="7" @input="onInput($event)" @blur="formatInput($event)" />
        </el-form-item>
        <el-form-item label="赠送金额:">
          <el-input v-model="temp.feeCount2" :disabled="csmInfo.isMainCard === 2" maxlength="7" placeholder="请输入" @input="feeCount2Input($event)" />
        </el-form-item>
        <el-form-item label="备注信息:" label-width="120px">
          <el-input v-model="temp.remark" :disabled="csmInfo.isMainCard === 2" type="textarea" resize="none" :maxlength="250" placeholder="请输入" />
        </el-form-item>
      </el-form>
    </div>
    <!-- 挂失/冻结/激活 -->
    <div v-if=" cradType===2 || cradType===3" class="item">
      <el-form ref="dataForm" class="form" label-position="right" label-width="100px">
        <el-form-item label="备注信息:" style="width: 100%;" label-width="100px">
          <el-input v-model="temp.remark" type="textarea" resize="none" :maxlength="250" placeholder="请输入" />
        </el-form-item>
      </el-form>
    </div>
    <!-- 换卡-->
    <div v-if=" cradType===4">
      <el-form ref="dataForm" class="form" label-position="right" label-width="100px">
        <el-form-item label="换卡工本费:">
          <el-input v-model="temp.cardFee" class="change-cardfee" placeholder="请输入" :disabled="true" />
        </el-form-item>
        <el-form-item label="备注信息:" style="width: 100%;" label-width="100px" class="remark-changecard">
          <el-input v-model="temp.remark" type="textarea" :maxlength="250" resize="none" placeholder="请输入" />
        </el-form-item>
      </el-form>
    </div>
    <!-- 销卡 -->
    <div v-if=" cradType===5 " class="item">
      <el-form ref="dataForm" class="form" label-position="right" label-width="100px">
        <el-form-item label="应退金额:">
          <el-input v-model="price.cashMoney" placeholder="请输入" :disabled="true" />
        </el-form-item>
        <el-form-item label="实退金额:">
          <el-input v-model="temp.money" placeholder="请输入" @input="onInput($event)" @blur="formatInput($event)" />
        </el-form-item>
        <el-form-item label="备注信息:" style="width: 100%;" label-width="90px">
          <el-input v-model="temp.remark" type="textarea" resize="none" :maxlength="250" placeholder="请输入" />
        </el-form-item>
      </el-form>
    </div>
    <!-- 手机号变更 -->
    <div v-if=" cradType===6 " class="item">
      <el-form ref="dataForm" class="form" label-position="right" label-width="144px">
        <el-form-item label="原绑定手机号:">
          <el-input v-model="csmInfo.csmPhone" placeholder="请输入" :disabled="true" />
        </el-form-item>
        <el-form-item label="变更后绑定手机号:" label-width="190px">
          <el-select v-model="csmPhone" style="width: 100%;" placeholder="请选择">
            <el-option
              v-for="(i, ind) in phoneItems"
              :key="ind"
              :label="i.csmPhone"
              :value="i.csmPhone"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="备注信息:" style="width: 100%;" label-width="90px">
          <el-input v-model="temp.remark" type="textarea" resize="none" :maxlength="250" placeholder="请输入" />
        </el-form-item>
      </el-form>
    </div>
    <!-- 卡密码修改 -->
    <div v-if=" cradType===7 " class="item">
      <el-form ref="password" class="form" :model="pas" :rules="rules" label-position="right" label-width="150px">
        <el-form-item label="请输入原密码:" style="width: 100%;" label-width="130px" prop="password1">
          <el-input v-model="pas.password1" placeholder="请输入" show-password maxlength="6" minlength="6" />
        </el-form-item>
        <el-form-item label="请输入新密码:" prop="password2">
          <el-input v-model="pas.password2" show-password placeholder="请输入" maxlength="6" minlength="6" />
        </el-form-item>
        <el-form-item label="再次输入新密码:" label-width="180px" prop="password3">
          <el-input v-model="pas.password3" show-password placeholder="请输入" maxlength="6" minlength="6" />
        </el-form-item>
        <el-form-item label="备注信息:" style="width: 100%;" label-width="90px">
          <el-input v-model="temp.remark" type="textarea" resize="none" placeholder="请输入" maxlength="80" />
        </el-form-item>
      </el-form>
    </div>
    <!-- 卡密码重置 -->
    <div v-if=" cradType===8" class="item">
      <el-form ref="dataForm" class="form" label-position="right" label-width="80px">
        <el-form-item label="备注信息:" style="width: 100%;" label-width="80px">
          <el-input v-model="temp.remark" type="textarea" resize="none" placeholder="请输入" :maxlength="250" />
        </el-form-item>
      </el-form>
    </div>
    <!-- 调账冲正 -->
    <div v-if=" cradType===9 " class="item">
      <el-form ref="dataForm" class="form" label-position="right" label-width="100px">
        <el-form-item label="调账类型:" label-width="100px" style="width: 100%;">
          <el-radio-group v-model="curtainTy" @change="changeGroup">
            <el-radio :label="1">充值调账</el-radio>
            <el-radio :label="2">消费调账</el-radio>
          </el-radio-group>
          <span>
            <i class="el-icon-question" @click.stop="isText = true" />
            <span v-if="isText" @click.stop="isText = false">
              充值调账:在原基础上增加金额;消费调账:在原基础上减少金额;
            </span>
          </span>
        </el-form-item>
        <el-form-item label="现金卡值调整:" label-width="158px">
          <el-input v-model.trim="price.updateCashMoney" placeholder="请输入" maxlength="7" @input="onInput($event, 'updateCashMoney')" @blur="onMoney($event,'updateCashMoney')" />
        </el-form-item>
        <el-form-item label="赠送卡值调整:" label-width="158px">
          <el-input v-model.trim="price.updateSendMoney" placeholder="请输入" maxlength="7" @input="onInput($event, 'updateSendMoney')" @blur="onMoney($event,'updateSendMoney')" />
        </el-form-item>
        <el-descriptions size="medium">
          <el-descriptions-item label="调整后现金卡值:">{{ price.changeCashMoney }}</el-descriptions-item>
          <el-descriptions-item label="调整后赠送卡值:">{{ price.changeSendMoney }}</el-descriptions-item>
          <el-descriptions-item label="调整后卡余额:">{{ price.changeCardSurplus }}</el-descriptions-item>
        </el-descriptions>
        <el-form-item label="备注信息:" style="width: 100%;" label-width="100px">
          <el-input v-model="temp.remark" type="textarea" resize="none" placeholder="请输入" :maxlength="250" />
        </el-form-item>
      </el-form>
    </div>
    <!-- 自动充值 -->
    <div v-if=" cradType===10 " class="item">
      <el-form ref="dataForm" class="form" :rules="rules" :model="temp" label-position="right" label-width="120px">
        <el-form-item label="企业名称:" prop="companyName">
          <el-input v-model="temp.companyName" :maxlength="40" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="开户银行:" prop="bankName">
          <el-input v-model="temp.bankName" :maxlength="30" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="账户号码:" prop="bankAccount">
          <el-input v-model="temp.bankAccount" :maxlength="20" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="备用字段:">
          <el-input v-model="temp.backup" placeholder="请输入" />
        </el-form-item>
      </el-form>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button v-if="cradType===1&&(!(!!(corpSettingData.sp2 >> 30 & 0x01)))" type="default" @click="saveAndPrint">充值并打印</el-button>
      <el-button v-if="cradType===5" type="default" @click="saveAndCancel">销卡并打印</el-button>
      <el-button @click="reset">关闭</el-button>
      <el-button type="primary" @click="onSubmit">{{ btnTxt }}</el-button>
    </div>
  </el-dialog>
</template>

<script>
  import { SmartReader, FUNCIDS } from '../js/interface'
  import { queryMap, topUpAdministrationCode, topUpAdministrationQuery, selectCsmcardByCsmCode, saveCsmCardBankAccount, refundCardUpdate, selectCsmcardByGroupCode, csmCardList, exactQueryGroup, getRefundDetail, recordDetail, updatePrintStatus, selectCloseCsmcardInfoByCsmId } from '@/api'
  import { topUpAdministrationInfoInfo, topUpAdministrationPrice, topUpAdministrationUpdate, topUpAdministrationChangeStatus, topUpAdministrationMelt, topUpAdministrationUserInfo, topUpAdministratioCsmPhone, topUpAdministratioPas, topUpAdministratioReset, topUpAdministratioAccount, topUpAdministratioTradePrice } from '@/api'
  import { parseTime, formatColumnMap, convertCurrency, amountHandle } from '@/utils'
  import { mergeAsyncFunc } from '@/utils/mergeAsyncFunc'
  import getTreeData from '@/utils/jsonTree'
  import { mapGetters } from 'vuex'
  export default {
    name: 'crad-operate',
    components: {
    },
    props: {
    },
    data() {
      return {
        treeData: [],
        formatColumnMap,
        isCode: false,
        isBtn: false,
        title: '',
        cradType: 0,
        btnTxt1: '获取验证码',
        countdown: 60, // 发送验证码时间60秒
        startSendMessageCode: 0, // 初始化为0
        messageCode: '',
        timer: '',
        userInfo: {},
        qtype: 'csmPhone',
        search: {
          param: ''
        },
        customerTypeMap: [],
        tableData: [],

        csmcardMax: 0,
        parseTime,
        visible: false,
        btnTxt: '充值',
        type: null,
        cardCode: '',
        csmInfo: {},
        phoneItems: [],
        curtainTy: 1, // 调账类型
        csmPhone: '', // 变更后绑定手机号
        isText: true,
        query: {
          useOrgId: '',
          cardFreeMoney: 0.00
        },
        temp: {
          feeCount1: 0.00,
          feeCount2: 0.00,
          remark: '',
          cardFee: 0,
          money: '',
          companyName: '', // 企业名称
          bankName: '', // 开户银行
          bankAccount: '', // 账户号码
          backup: '' // 备用字段
        },
        // 修改密码
        pas: {
          password1: '', // 原密码
          password2: '', // 新密码
          password3: '' // 再次输入的新密码
        },
        rules: {
          password1: [{ required: true, message: '请输入原密码', trigger: 'change' }, { min: 6, max: 6, message: '请输入六位数密码', trigger: 'blur' }],
          password2: [{ required: true, message: '请输入新密码', trigger: 'change' }, { min: 6, max: 6, message: '请输入六位数新密码', trigger: 'blur' }],
          password3: [{ required: true, message: '请再次输入新密码', trigger: 'change' }, { min: 6, max: 6, message: '请再次输入六位数新密码', trigger: 'blur' }],
          companyName: [
            { required: true, message: '请输入企业名称', trigger: 'change' }
          ],
          bankName: [
            { required: true, message: '请输入开户银行', trigger: 'change' }
          ],
          bankAccount: [
            { required: true, message: '请输入账户号码', trigger: 'change' }
          ]
        },
        // 调账
        price: {
          updateCashMoney: 0.00, // 现金卡值调整
          changeCashMoney1: 0.00, // 初始数据现金卡值
          changeSendMoney1: 0.00, // 初始数据赠送卡值调整
          changeCardSurplus1: 0.00, // 初始数据调整后卡余额/余次
          updateSendMoney: 0.00, // 赠送卡值调整
          changeCashMoney: 0.00, // 调整后现金卡值
          changeSendMoney: 0.00, // 调整后赠送卡值
          changeCardSurplus: 0.00// 调整后卡余额
        },
        /* 读卡/写卡相关参数*/
        obj: null, // 读卡器函数
        locked: false,
        csmCardRWType: 0, // 0是默认状态 1是读卡状态 2是写卡状态 3是清卡状态
        readClass: 1,
        writeClass: 2,
        hasCard: false,
        isComOpen: false,
        icdev: -1,
        gl_sector: 0, // 扇区 0-15扇区  总共64个扇区
        gl_BinBlock: 1, // 快   0-63 但0不可用,
        gl_wantFunc: 0,
        readerCardCode: '', // 读卡号
        readerIndex: 1, // 读卡第一扇区值
        readerStrCode: '', // 读卡第二扇区值
        writerCsmCard: '', // 写卡号
        writerNowDate: '', // 充值卡第二扇区值
        groupData: {
          total: 0,
          data: [],
          column: [
            {
              type: 'index'
            },
            {
              type: 'selection',
              width: 50
            },
            {
              prop: 'csmCode',
              label: '客户编号',
              width: 100
            },
            {
              prop: 'csmName',
              label: '客户名称',
              showOverflowTooltip: true,
              width: 100
            },
            {
              prop: 'csmType',
              label: '客户类型',
              width: 100,
              render: (h, { row }) => <span>{ row.csmType && formatColumnMap(this.customerTypeMap, 'value', row.csmType, 'desc') }</span>
            },
            {
              prop: 'orgName',
              label: '所属机构',
              width: 100,
              showOverflowTooltip: true
            },
            {
              prop: 'cardCode',
              label: '充值卡号',
              width: 100,
              showOverflowTooltip: true
            },
            {
              prop: 'isMainCard',
              label: '主副卡',
              width: 100,
              showOverflowTooltip: true,
              formatter: row => row.isMainCard ? row.isMainCard === 1 ? '主卡' : row.isMainCard === 2 ? '副卡' : '' : ''

            },
            {
              prop: 'cardSurplus',
              label: '卡余额',
              width: 100,
              showOverflowTooltip: true,
              formatter: row => row.cardSurplus ? row.cardSurplus * 1.00 / 100 : '0.00'
            },
            {
              prop: 'useOrgName',
              label: '使用门店',
              width: 100,
              showOverflowTooltip: true
            },
            {
              prop: 'csmRgAddress',
              label: '地址',
              width: 100,
              showOverflowTooltip: true
            },
            {
              prop: 'csmPhone',
              label: '联系电话',
              width: 100,
              showOverflowTooltip: true
            }
          ]
        },
        groupSelection: [],
        isGroup: false,
        selectioned: {},
        groupTypeList: [
          { desc: '企业', value: 1 },
          { desc: '连锁', value: 2 }
        ],
        isAllOrg: false
      }
    },
    computed: {
      ...mapGetters([
        'orgList',
        'corpSettingData'
      ])
    },
    created() {
      this.queryOptionsMap()
    },
    methods: {
      // 查询枚举
      async queryOptionsMap() {
        const [res1] = await Promise.all([mergeAsyncFunc(queryMap, { enumName: 'CustomerType' })])
        this.customerTypeMap = res1.data // 客户类型
      },
      // 获取所属机构数据
      async getTreeData() {
        const data = this.orgList.map(item => ({
          label: item.name,
          ...item
        }))
        this.treeData = getTreeData(data)
      },
      change(val) {
        this.groupData.data = []
        this.groupData.total = 0
        this.groupSelection = []
        this.csmInfo = {}
        this.isGroup = false
        this.isAllOrg = false
        this.query = {
          useOrgId: '',
          cardFreeMoney: 0.00
        }
        if (val === 'csmPhone') {
          const condition = [1, 9, 10, 11]
          if (condition.includes(this.cradType)) {
            this.isCode = false
            this.isBtn = false
          } else {
            this.isCode = true
            this.isBtn = true
            this.btnTxt1 = '获取验证码'
          }
        } else if (val === 'csmCode') {
          this.isCode = false
          this.isBtn = false
        } else if (val === 'groupCode') {
          this.isCode = false
          this.isBtn = false
        } else {
          this.isCode = false
          this.isBtn = true
          this.btnTxt1 = '读卡'
        }
      },
      async searchTxt() {
        this.isGroup = false
        var _this = this
        // 电话校验
        if (_this.qtype === 'csmPhone') {
          if (!_this.search.param) {
            this.$message({
              type: 'warning',
              message: '请输入电话号码'
            })
            return
          }
          // 需要校验验证码
          if (_this.isCode) {
            // 校验验证码
            if (_this.messageCode === '') {
              _this.$message({
                type: 'warning',
                message: '请输入验证码!'
              })
              return
            }
            if (_this.messageCode.length !== 6) {
              _this.$message({
                type: 'warning',
                message: '验证码为6位!'
              })
              return
            }
          }
          const res = await topUpAdministrationQuery({
            csmPhone: _this.search.param,
            messageCode: _this.messageCode
          })
          _this.tableData = res.data
          if (res.data.length === 1) {
            _this.userInfo = res.data[0]
            // 根据充值卡状态,找出不支持的操作
            const backInfo = _this.selectCardStatus(_this.userInfo.cardStatus)
            if (!backInfo.status) {
              _this.$message({
                type: 'warning',
                message: `${backInfo.msg}`
              })
            } else {
              // 检索成功------打开别的弹框
              _this.open({ cardCode: _this.userInfo.cardCode, type: _this.cradType, title: _this.title })
            }
          }
        // 卡号校验
        } else if (_this.qtype === 'csmCode') {
          if (!_this.search.param) {
            this.$message({
              type: 'warning',
              message: '请输入客户编号'
            })
            return
          }
          // 需要校验验证码
          if (_this.isCode) {
            // 校验验证码
            if (_this.messageCode === '') {
              _this.$message({
                type: 'warning',
                message: '请输入验证码!'
              })
              return
            }
            if (_this.messageCode.length !== 6) {
              _this.$message({
                type: 'warning',
                message: '验证码为6位!'
              })
              return
            }
          }
          let res
          if (this.cradType === 2) {
            res = await selectCloseCsmcardInfoByCsmId({
              csmCode: _this.search.param
            })
          } else {
            res = await selectCsmcardByCsmCode({
              csmCode: _this.search.param
            })
          }

          _this.userInfo = res.data
          // 根据充值卡状态,找出不支持的操作
          const backInfo = _this.selectCardStatus(_this.userInfo.cardStatus)
          if (backInfo.status === false) {
            _this.$message({
              type: 'warning',
              message: `${backInfo.msg}`
            })
            return
          }
          // 检索成功------打开别的弹框
          _this.open({ cardCode: _this.userInfo.cardCode, type: _this.cradType, title: _this.title })
        } else if (_this.qtype === 'cardCode') {
          if (!_this.search.param) {
            this.$message({
              type: 'warning',
              message: '请输入卡号'
            })
            return
          }
          // 查询充值卡是否存在
          const res = await topUpAdministrationInfoInfo({
            cardCode: _this.search.param,
            cardStrCode: _this.readerStrCode
          })
          console.log('yyyyyyyyyyy', res)
          _this.userInfo = res.data
          // 根据充值卡状态,找出不支持的操作
          const backInfo = _this.selectCardStatus(_this.userInfo.cardStatus)
          if (backInfo.status === false) {
            _this.$message({
              type: 'warning',
              message: `${backInfo.msg}`
            })
            return
          }
          // 检索成功------打开别的弹框
          _this.open({ cardCode: _this.userInfo.cardCode, type: this.cradType, title: _this.title })
        } else if (_this.qtype === 'groupCode') {
          if (!_this.search.param) {
            this.$message({
              type: 'warning',
              message: '请输入客户组号'
            })
            return
          }
          const res = await selectCsmcardByGroupCode({ groupCode: _this.search.param })
          if (this.cradType === 11) {
            _this.tableData = res.data
          } else {
            _this.userInfo = res.data[0]
            // 根据充值卡状态,找出不支持的操作
            const backInfo = _this.selectCardStatus(_this.userInfo.cardStatus)
            if (backInfo.status === false) {
              _this.$message({
                type: 'warning',
                message: `${backInfo.msg}`
              })
              return
            }
            // 检索成功------打开别的弹框
            _this.open({ cardCode: _this.userInfo.cardCode, type: this.cradType, title: _this.title })
          }
        }
      },
      // 关联客户信息
      async groupFetchData({ currentPage, pageSize }) {
        const query = {
          currentPage, pageSize,
          params: {
            groupCode: this.selectioned.csmCode
          }
        }
        const res = await csmCardList(query)
        this.groupData.data = res.data.rows
        if (currentPage === 1) this.groupData.total = res.data.total
        let g = this.groupData.data
        g = g.filter(item => item.isMainCard === 2)
        this.groupSelection = g
        this.$nextTick(() => {
          g.forEach(item => {
            this.$refs.groupTable.toggleRowSelection(item, true)
          })
          this.groupSelectHandle()
        })
      },
      // 勾选
      dialogCheck(selection, row) {
        this.$refs.lbTable.clearSelection()
        if (selection.length === 0) { // 判断selection是否有值存在
          this.groupData.data = []
          this.groupData.total = 0
          return
        }
        if (row) {
          this.$refs.lbTable.toggleRowSelection(row, true)
          this.selectioned = row
          if (row.cardOpenStatus === 1) {
            this.isGroup = false
          }

          if (row.csmCode && row.cardOpenStatus === 2) {
            this.isGroup = true
            this.userInfo = row
            if (this.cradType === 11) {
              this.$nextTick(() => {
                this.$refs.groupTable.fetch({ currentPage: 1 })
              })
            }
          }

          // 根据充值卡状态,找出不支持的操作
          const backInfo = this.selectCardStatus(row.cardStatus)
          if (!backInfo.status) {
            this.$message({
              type: 'warning',
              message: `${backInfo.msg}`
            })
          } else {
            // 检索成功------打开别的弹框
            this.open({ cardCode: row.cardCode, type: this.cradType, title: this.title })
          }
        }
      },
      rowClick(row) {
        // 根据充值卡状态,找出不支持的操作
        const backInfo = this.selectCardStatus(row.cardStatus)
        if (!backInfo.status) {
          this.$message({
            type: 'warning',
            message: `${backInfo.msg}`
          })
        } else {
          // 检索成功------打开别的弹框
          this.open({ cardCode: row.cardCode, type: this.cradType, title: this.title })
        }
      },
      // 发送验证码
      async sendMessageCode() {
        if (this.qtype === 'cardCode') {
          // 读卡
          this.readCardCode(1)
          return
        }
        if (!this.search.param) {
          this.$message({
            type: 'warning',
            message: '请输入电话号码'
          })
          return
        }
        if (this.startSendMessageCode === 0) {
          this.startSendMessageCode = 1
          // 发送接口
          const res = await topUpAdministrationCode({
            csmPhone: this.search.param,
            type: 1
          })
          console.log('成功', res)
          this.timer = setInterval(() => {
            this.settime()
          }, 1000)
        }
      },
      // 初始化读卡器
      initCardServer() {
        var _this = this
        _this.obj = SmartReader.OBJ()
        _this.obj.createSocket()
        _this.obj.onResult(async(rData) => {
          console.log('进入的状态,rData.FunctionID', rData)
          console.log('进入的状态,rData.FunctionID', rData.FunctionID)
          switch (rData.FunctionID) {
          case FUNCIDS._fid_initialcom:
            var rel = Number(rData.RePara_Int)
            if (rel === 0) {
              var hdev = parseInt(rData.RePara_Str)
              if (hdev !== -1) {
                _this.icdev = hdev
                _this.obj.beep(_this.icdev, 10) // do a beep
                _this.isComOpen = true // Set reader link status
                _this.readerCsmCard = ''
                _this.LoadKey() // 验证密码
              } else {
                _this.locked = false
                _this.$message({
                  type: 'warning',
                  message: '打开读卡器失败'
                })
                return
              }
            } else {
              _this.locked = false
              _this.$message({
                type: 'warning',
                message: '打开读卡器失败'
              })
              return
            }
            break
          case FUNCIDS._fid_exit: // 关闭读卡器
            break
          case FUNCIDS._fid_beep: // 峰槽声
            break
          case FUNCIDS._fid_loadKey: // 校验密码
            if (_this.csmCardRWType === 1) { // 说明是读卡状态
              _this.Read()
            } else if (_this.csmCardRWType === 2) { // 写卡充能
              _this.Write()
            } else if (_this.csmCardRWType === 3) { // 清卡功能
              _this.Write()
            }
            break
          case FUNCIDS._fid_findCardStr: // 读取操作进入
            var strcard = rData.RePara_Str
            if (strcard !== '') {
              _this.hasCard = true
              switch (_this.gl_wantFunc) {
              case _this.readClass:
              case _this.writeClass:
                _this.obj.authentication(_this.icdev, 0, _this.gl_sector)
                break
              }
            } else {
              _this.$message({
                type: 'warning',
                message: '充值设备连接异常，请联系管理员'
              })
              _this.locked = false
              _this.CloseCsmcard()
              return
            }
            break
          case FUNCIDS._fid_authenClass: // 读取
            var rel1 = Number(rData.RePara_Int)
            if (rel1 === 0) {
              switch (_this.gl_wantFunc) {
              case _this.readClass: // 读卡号
                // 读取卡号
                if (_this.readerIndex === 1) {
                  _this.obj.read(_this.icdev, _this.gl_BinBlock)
                  // 读取卡第二扇区值
                } else if (_this.readerIndex === 2) {
                  _this.obj.read(_this.icdev, 2)
                }
                break
              case _this.writeClass: // 写卡号
                _this.obj.write(_this.icdev, _this.gl_BinBlock, _this.writerCsmCard)
                break
              }
            } else {
              _this.$message({
                type: 'warning',
                message: '充值设备连接异常，请联系管理员'
              })
              _this.locked = false
              _this.CloseCsmcard()
              return
            }
            break
          case FUNCIDS._fid_readAsStr: // 输出读取的卡号
            var data = rData.RePara_Str
            if (data !== '') {
              // 读取卡号
              if (_this.readerIndex === 1) {
                _this.readerCsmCard = data
                console.log('读取的卡号_this.readerCsmCard', _this.readerCsmCard)
                // 处理卡号
                if (_this.readerCsmCard === '') {
                  _this.$message({
                    type: 'warning',
                    message: '读取卡号失败'
                  })
                  _this.CloseCsmcard()
                  return
                }

                var strArr = _this.readerCsmCard.split('')
                var newCardCode = ''
                for (var x = 0; x < strArr.length; x++) {
                  if (strArr[x] !== 'A') {
                    newCardCode = newCardCode + strArr[x]
                  }
                }

                // 卡号
                _this.readerCsmCard = newCardCode
                _this.CloseCsmcard()
                // 显示读取的卡号
                if (newCardCode === '00000000000000000000000000000000') {
                  _this.$message({
                    type: 'warning',
                    message: '当前卡读取不到卡号,属于空卡'
                  })
                } else {
                  // 卡号
                  _this.temp.param = newCardCode
                  console.log('_this.temp.param', _this.temp.param)
                  // 开始读取第二扇区随机数
                  _this.readCardCode(2)
                }
              } else if (_this.readerIndex === 2) {
                _this.readerStrCode = data
                console.log('第二区_this.readerStrCode', _this.readerStrCode)
                if (_this.readerStrCode === '00000000000000000000000000000000') {
                  _this.readerStrCode = ''
                }
                // 读取完成第二扇区随机数,将readerIndex值设置成默认值
                _this.readerIndex = 1
                _this.CloseCsmcard()
              }
            } else {
              _this.$message({
                type: 'warning',
                message: '充值设备连接异常，请联系管理员'
              })
              _this.locked = false
              _this.CloseCsmcard()
              return
            }
            break
          case FUNCIDS._fid_writeAsStr: // 输出写入的卡号
            var iRet = Number(rData.RePara_Int)
            if (iRet === 0) {
              // 写入卡片成功
              _this.CloseCsmcard()
            } else {
              _this.$message({
                type: 'warning',
                message: '写入卡片失败'
              })
              _this.CloseCsmcard()
              return
            }
            break
          }
        })
      },
      // 读卡
      readCardCode(index) {
        console.log('读卡')
        var _this = this
        var isOpen = _this.obj.isSocketOpen()
        console.log('读卡状态..isOpen', isOpen)
        if (!isOpen) {
          this.$message({
            type: 'warning',
            message: '充值设备连接异常，请联系管理员'
          })
          return
        }

        _this.readerIndex = index
        _this.csmCardRWType = 1// 设置读卡器状态为读卡状态
        _this.OpenCsmcard() // 打开读卡器
      },
      // 打开读卡器
      OpenCsmcard() {
        var _this = this
        try {
          if (_this.isComOpen === false) {
            console.log('打开读卡器', _this.isComOpen)
            _this.obj.initialcom(100, 0)
          }
        } catch (e) {
          alert(e.message)
        }
        return
      },
      // 校验A密码
      LoadKey() {
        var _this = this
        _this.obj.loadkey(_this.icdev, 0, _this.gl_sector, 'FFFFFFFFFFFf') // Load key, 0: keyA, ffffffffffff:key
      },
      // 读卡
      Read() {
        var _this = this
        _this.obj.findcardStr(_this.icdev, 0)// 1);     //1: multy card mode
        _this.gl_wantFunc = _this.readClass
      },
      // 写卡
      Write() {
        var _this = this
        _this.obj.findcardStr(_this.icdev, 0)// 1);     //1: multy card mode
        _this.gl_wantFunc = _this.writeClass
      },
      // 关闭读卡器
      CloseCsmcard() {
        var _this = this
        _this.obj.exit(_this.icdev)
        _this.isComOpen = false // Set unlink status
      },
      // 验证码倒计时
      settime() {
        if (this.countdown === 0) {
          clearInterval(this.timer)
          this.btnTxt1 = '免费获取验证码'
          this.countdown = 60
          this.startSendMessageCode = 0
          return
        } else {
          this.countdown--
          this.btnTxt1 = `重新发送${this.countdown}`
        }
      },
      // 根据充值卡状态,找出不支持的操作
      selectCardStatus(cardStatus) {
        var backInfo = {
          status: true
        }
        if (cardStatus === -1) {
          backInfo.status = false
          backInfo.msg = '充值卡已注销，不可操作'
          if (this.cradType === 5) {
            backInfo.msg = '充值卡已注销，不需要再次注销'
          }
          return backInfo
        }

        switch (this.cradType) {
        // 打开充值界面
        case 1:
          if (cardStatus === 3) {
            backInfo.status = false
            backInfo.msg = '充值卡已冻结，请先激活再操作'
            return backInfo
          }
          break
        // 激活
        case 2:
          if (cardStatus === 2) {
            backInfo.status = false
            backInfo.msg = '充值卡已激活，不需要再次激活'
            return backInfo
          }
          break
        // 挂失/冻结
        case 3:
          if (cardStatus === 3) {
            backInfo.status = false
            backInfo.msg = '充值已冻结，不需要再次操作'
            return backInfo
          }
          break
        }
        return backInfo
      },

      async open(data) {
        console.log('ddddd', data)
        this.maxPrice()
        const { cardCode, type, title } = data
        const obj = {
          1: '充值',
          2: '激活',
          3: '冻结',
          4: '换卡',
          5: '销卡',
          6: '保存',
          7: '保存',
          8: '重置',
          9: '调账',
          10: '保存',
          11: '保存'
        }
        this.btnTxt = obj[type]
        this.type = type
        this.title = title
        await Promise.all([this.getUserInfo(cardCode), this.initCardServer()])
        return new Promise(resolve => {
          this.resolve = resolve
          this.visible = true
          if (this.type === 11) {
            if (this.csmInfo.cardOpenStatus === 2) {
              const d_org = this.orgList.find(item => item.parentId === 0)
              if (d_org && d_org.orgId) {
                this.query.useOrgId = d_org.orgId
                this.isAllOrg = true
              }
            } else {
              this.query.useOrgId = this.csmInfo.useOrgId
            }

            this.query.cardFreeMoney = this.csmInfo.cardFreeMoney && (this.csmInfo.cardFreeMoney / 100).toFixed(2)
          }
        })
      },
      async maxPrice() {
        const res = await topUpAdministratioTradePrice()
        console.log(res)
        this.csmcardMax = res.data && (res.data.csmcardMax / 100).toFixed(2)
        this.temp.cardFee = res.data && (res.data.wordFeeOne / 100).toFixed(2)
      },
      // 提交
      async onSubmit() {
        switch (this.type * 1) {
        case 0:
          break
        case 1: // 充值
          this.$refs.dataFormCharge.validate(valid => {
            if (!valid) return

            if (this.csmInfo.isMainCard === 2) {
              this.$message.warning('副卡不能充值')
              return
            }

            // if ((this.temp.feeCount1 * 1) + (this.csmInfo.cardSurplus * 1) < 0) {
            //   this.$message.warning('充值负金额只能小于等于卡内余额')
            //   return
            // } 2023.7.24注释 充值卡信用额度需求修改；

            if (((this.temp.feeCount1 * 1) === 0) && ((this.temp.feeCount2 * 1) === 0)) {
              this.$message.warning('充值金额和赠送金额不能同时为0')
              return
            }

            // 单次充值金额字段待向后端确认
            if ((this.temp.feeCount1 * 1) > this.csmcardMax) {
              this.$message.warning('充值金额' + (this.temp.feeCount1 * 1) + '元,大于最大单次充值金额' + this.csmcardMax * 1 + '元')
              return
            }

            this.$confirm('确认充值金额？', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(async() => {
              const feeCount = (this.temp.feeCount1 * 1) + (this.temp.feeCount2 * 1)
              const params = {
                actUser: this.csmInfo.csmName,
                actUserId: this.csmInfo.csmId,
                cardCode: this.csmInfo.cardCode,
                rcType: this.csmInfo.rcType,
                cardSurplus: this.csmInfo.cardSurplus,
                accCsmcardRecordList: [
                  {
                    cardCode: this.csmInfo.cardCode,
                    feeCount: amountHandle(feeCount, 0),
                    feeCount1: amountHandle(this.temp.feeCount1, 0),
                    feeCount2: amountHandle(this.temp.feeCount2, 0),
                    singleMoney: amountHandle(this.temp.feeCount1, 0),
                    remark: this.temp.remark
                  }
                ]
              }
              const res = await topUpAdministrationUpdate(params)
              if (res.status === 200) {
                this.$message({
                  type: 'success',
                  message: '充值余额成功！'
                })
                this.visible = false
              }
            })
          })

          break
        case 2: // 激活
        case 3: // 冻结
          var params1 = {
            cardCode: this.csmInfo.cardCode,
            cardStatus: this.type, // 2 激活  3 冻结
            remark: this.temp.remark
          }
          if (this.type === 3) {
            if (this.temp.remark === '') {
              this.$message({
                type: 'warning',
                message: '冻结当前充值卡,备注必须填写'
              })
              return
            }
          }
          var res1 = await topUpAdministrationChangeStatus(params1)
          if (res1.status === 200) {
            this.$message({
              type: 'success',
              message: '修改成功！'
            })
            this.visible = false
          }
          break
        case 4: // 换卡
          var _this = this
          _this.csmCardRWType = 1// 设置读卡器状态为读卡状态
          var isOpen = _this.obj.isSocketOpen()
          console.log('读卡状态..isOpen', isOpen)
          if (!isOpen) {
            this.$message({
              type: 'warning',
              message: '充值设备连接异常，请联系管理员'
            })
            _this.locked = false
            return
          }
          _this.readerIndex = 1
          if (_this.locked) {
            return
          }
          _this.locked = true
          _this.OpenCsmcard() // 打开读卡器
          break
        case 5: // 销卡
          var cardSurplus = this.numberFormat1(this.csmInfo.cardSurplus) || 0
          console.log(cardSurplus, '---卡余额')
          if (cardSurplus < 0) {
            this.$confirm('当前卡号欠费，请充值后再销卡', '提示', {
              confirmButtonText: '立即充值',
              cancelButtonText: '关闭',
              type: 'warning'
            }).then(() => {
              this.title = '充值'
              this.cradType = 1
              this.btnTxt = '充值'
              this.type = 1
            }).catch(() => {
              this.$message({
                type: 'info',
                message: '已取消'
              })
            })
            return
          }

          if (!this.temp.money) {
            this.$message({
              type: 'warning',
              message: '请输入实退金额'
            })
            return
          }
          var params2 = {
            csmCode: this.csmInfo.csmCode,
            cardCode: this.csmInfo.cardCode,
            money5: amountHandle(this.price.cashMoney, 0),
            money6: amountHandle(this.temp.money, 0),
            remark: this.temp.remark
          }
          var money = params2.money6 - params2.money5
          if (money > 0) {
            this.$message({
              type: 'warning',
              message: '应退金额必须小于实退金额'
            })
            return
          }
          this.$confirm('确认销卡退款吗？', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(async() => {
            var res2 = await topUpAdministrationMelt(params2)
            if (res2.status === 200) {
              this.$message({
                type: 'success',
                message: '销卡退款成功！'
              })
              this.visible = false
            }
          })
          break
        case 6: // 手机号变更
          if (this.csmInfo.csmPhone * 1 === this.csmPhone * 1) {
            this.$message({
              type: 'warning',
              message: '更换后的电话与原电话不能相同'
            })
            return
          }
          var params3 = {
            csmPhone: this.csmPhone,
            cardCode: this.csmInfo.cardCode,
            remark: this.temp.remark
          }
          var res2 = await topUpAdministratioCsmPhone(params3)
          if (res2.status === 200) {
            this.$message({
              type: 'success',
              message: '更改绑定手机号成功！'
            })
            this.visible = false
          }
          break
        case 7: // 卡密码修改
          this.$refs.password.validate().then(async(res) => {
            if (this.pas.password1 === this.pas.password2) {
              this.$message({
                type: 'warning',
                message: '储值卡修改密码相同'
              })
              return
            }
            if (this.pas.password2 !== this.pas.password3) {
              this.$message({
                type: 'warning',
                message: '确认免密与新密码输入不相同'
              })
              return
            }
            var params4 = {
              cardCode: this.csmInfo.cardCode,
              password1: this.pas.password1, // 原密码
              password2: this.pas.password2, // 新密码
              remark: this.temp.remark
            }
            var res3 = await topUpAdministratioPas(params4)
            if (res3.status === 200) {
              this.$message({
                type: 'success',
                message: '修改密码成功！'
              })
              this.visible = false
            }
          })
          break
        case 8: // 卡密码重置
          var params5 = {
            cardCode: this.csmInfo.cardCode,
            remark: this.temp.remark
          }
          var res4 = await topUpAdministratioReset(params5)
          if (res4.status === 200) {
            this.$message({
              type: 'success',
              message: '重置密码成功！'
            })
            this.visible = false
          }
          break
        case 9: // 调账冲正
          var m = (amountHandle(this.price.changeCashMoney, 0)) + Number(this.csmInfo.cardFreeMoney)
          if (m < 0) {
            this.$message({
              type: 'warning',
              message: '调整后现金卡值不能超过信用额度'
            })
            return
          }
          // 获取调整后赠送卡值
          if (amountHandle(this.price.changeSendMoney, 0) < 0) {
            this.$message({
              type: 'warning',
              message: '调整后赠送卡值最小为0'
            })
            return
          }
          // 获取调整后卡余额/余次
          if (m < 0) {
            this.$message({
              type: 'warning',
              message: '调整后卡余额不能超过信用额度'
            })
            return
          }
          var params6 = {
            cardCode: this.csmInfo.cardCode,
            accCsmcardRecordList: [
              {
                feeCount1: this.curtainTy === 1 ? amountHandle(this.price.updateCashMoney, 0) : -amountHandle(this.price.updateCashMoney, 0),
                feeCount2: this.curtainTy === 1 ? amountHandle(this.price.updateSendMoney, 0) : -amountHandle(this.price.updateSendMoney, 0),
                remark: this.temp.remark
              }
            ],
            optFlag: this.curtainTy === 1 ? 13 : this.curtainTy === 2 ? 14 : ''
          }
          var res5 = await topUpAdministratioAccount(params6)
          if (res5.status === 200) {
            this.$message({
              type: 'success',
              message: '调账冲正成功！'
            })
            this.visible = false
          }
          break
        case 10:
          this.$confirm('确认保存自动充值信息吗？', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(async() => {
            var json = {
              cardCode: this.csmInfo.cardCode,
              companyName: this.temp.companyName, // 企业名称
              bankName: this.temp.bankName, // 开户银行
              bankAccount: this.temp.bankAccount, // 账户号码
              backup: this.temp.backup // 备用字段
            }
            var res5 = await saveCsmCardBankAccount({ json })
            if (res5.status === 200) {
              this.$message({
                type: 'success',
                message: '自动充值成功！'
              })
              this.visible = false
            }
          })
          break
        case 11:
          console.log(this.csmInfo, this.query, '---卡信息编辑-')
          var params = {
            cardCode: this.csmInfo.cardCode,
            cardFreeMoney: amountHandle(this.query.cardFreeMoney, 0),
            useOrgId: this.query.useOrgId,
            csmCardList: this.isGroup ? this.groupSelection : undefined
          }
          var resEdit = await refundCardUpdate(params)
          if (resEdit.status === 200) {
            this.$message({
              type: 'success',
              message: '卡信息修改成功！'
            })
            this.visible = false
            this.query = {
              useOrgId: '',
              cardFreeMoney: 0.00
            }
          }

          break
        default:
          break
        }
      },
      // 充值并打印
      saveAndPrint() {
        console.log(window.jCPrint, '------------')
        const cache = JSON.parse(localStorage.tp)
        if (!cache) {
          this.$message.warning('请先设置打印模板')
          return
        }
        const temp = cache['42']
        if (!temp) {
          this.$message.warning('请先设置打印模板')
          return
        }
        this.$refs.dataFormCharge.validate(valid => {
          if (!valid) return
          if (this.csmInfo.isMainCard === 2) {
            this.$message.warning('副卡不能充值')
            return
          }
          if (((this.temp.feeCount1 * 1) === 0) && ((this.temp.feeCount2 * 1) === 0)) {
            this.$message.warning('充值金额和赠送金额不能同时为0')
            return
          }
          // 单次充值金额字段待向后端确认
          if ((this.temp.feeCount1 * 1) > this.csmcardMax) {
            this.$message.warning('充值金额' + (this.temp.feeCount1 * 1) + '元,大于最大单次充值金额' + this.csmcardMax * 1 + '元')
            return
          }
          this.$confirm('确认充值金额？', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(async() => {
            const feeCount = (this.temp.feeCount1 * 1) + (this.temp.feeCount2 * 1)
            const params = {
              actUser: this.csmInfo.csmName,
              actUserId: this.csmInfo.csmId,
              cardCode: this.csmInfo.cardCode,
              rcType: this.csmInfo.rcType,
              cardSurplus: this.csmInfo.cardSurplus,
              accCsmcardRecordList: [
                {
                  cardCode: this.csmInfo.cardCode,
                  feeCount: amountHandle(feeCount, 0),
                  feeCount1: amountHandle(this.temp.feeCount1, 0),
                  feeCount2: amountHandle(this.temp.feeCount2, 0),
                  singleMoney: amountHandle(this.temp.feeCount1, 0),
                  remark: this.temp.remark
                }
              ]
            }
            const res = await topUpAdministrationUpdate(params)
            if (res.status === 200) {
              this.$message({
                type: 'success',
                message: '充值余额成功！'
              })
              this.visible = false
              if (res.data) {
                this.toFillPrint(res.data)
              }
            }
          })
        })
      },
      // 充值打印
      async toFillPrint(val) {
        const param = {
          recordId: val
        }
        const res = await recordDetail(param)
        if (res && res.data) {
          const row = JSON.parse(JSON.stringify(res.data))
          const paramData = {
            csmCode: row.csmCode,
            happendTime: parseTime(new Date(row.happendTime), '{y}-{m}-{d} {h}:{i}:{s}'),
            csmName: row.csmName,
            feeCountUppercase: convertCurrency((row.feeCount1 * 1.00 / 100)),
            feeCount1: (row.feeCount1 * 1.00 / 100),
            remark: row.remark,
            operatorName: row.operatorName,
            cardCode: row.cardCode,
            recordId: row.recordId
          }
          this.print(paramData, 1)
        }
      },
      // 销卡并打印
      async saveAndCancel() {
        const cache = JSON.parse(localStorage.tp)
        if (!cache) {
          this.$message.warning('请先设置打印模板')
          return
        }
        const temp = cache['43']
        if (!temp) {
          this.$message.warning('请先设置打印模板')
          return
        }

        var cardSurplus = this.numberFormat1(this.csmInfo.cardSurplus) || 0
        if (cardSurplus < 0) {
          this.$confirm('当前卡号欠费，请充值后再销卡', '提示', {
            confirmButtonText: '立即充值',
            cancelButtonText: '关闭',
            type: 'warning'
          }).then(() => {
            this.title = '充值'
            this.cradType = 1
            this.btnTxt = '充值'
            this.type = 1
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消'
            })
          })
          return
        }

        if (!this.temp.money) {
          this.$message({
            type: 'warning',
            message: '请输入实退金额'
          })
          return
        }
        var params2 = {
          csmCode: this.csmInfo.csmCode,
          cardCode: this.csmInfo.cardCode,
          money5: amountHandle(this.price.cashMoney, 0),
          money6: amountHandle(this.temp.money, 0),
          remark: this.temp.remark
        }
        var money = params2.money6 - params2.money5
        if (money > 0) {
          this.$message({
            type: 'warning',
            message: '应退金额必须小于实退金额'
          })
          return
        }
        this.$confirm('确认销卡退款吗？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async() => {
          var res2 = await topUpAdministrationMelt(params2)
          if (res2.status === 200) {
            this.$message({
              type: 'success',
              message: '销卡退款成功！'
            })
            this.visible = false
            this.toCancelprint()
          }
        })
      },
      async toCancelprint() {
        const param = {
          cardCode: this.csmInfo.cardCode
        }
        const res = await getRefundDetail(param)
        if (res && res.data) {
          const row = JSON.parse(JSON.stringify(res.data))
          const paramData = {
            csmCode: row.csmCode,
            refundTime: parseTime(new Date(row.refundTime), '{y}-{m}-{d} {h}:{i}:{s}'),
            csmName: row.csmName,
            realMoneyUppercase: convertCurrency((row.realMoney * 1.00 / 100)),
            realMoney: (row.realMoney * 1.00 / 100),
            remark: row.remark,
            createUser: row.createUser,
            cardCode: row.cardCode,
            recordId: row.recordId
          }
          this.print(paramData, 2)
        }
      },
      // 打印
      async print(r, type) {
        const cache = JSON.parse(localStorage.tp)
        if (!cache) {
          this.$message.warning('请先设置打印模板')
          return
        }
        let temp
        if (type === 1) {
          temp = cache['42']
        }
        if (type === 2) {
          temp = cache['43']
        }

        if (!temp) {
          this.$message.warning('请先设置打印模板')
          return
        }

        let printcmd = {
          cmd: 2,
          title: `正在打印`,
          elements: []
        }
        if (type === 1) {
          printcmd.title = `正在对预付卡${r.cardCode}进行打印`
        }
        if (type === 2) {
          printcmd.title = `正在对预付卡销卡${r.cardCode}进行打印`
        }

        printcmd = { ...printcmd, ...temp }
        window.jCPrint.process(printcmd, temp, r)
        delete printcmd.els
        if (window.jCPrint.firePush(JSON.stringify(printcmd))) {
          this.$message.success('打印指令已发送')
          await updatePrintStatus({ optFlag: (type === 1) ? 1 : 3, cardCode: r.cardCode, recordId: r.recordId })
        } else {
          this.$message.error('打印未连接')
        }
      },

      reset() {
        clearInterval(this.timer)
        this.isCode = false
        this.isBtn = false
        this.messageCode = ''
        this.btnTxt1 = '获取验证码'
        this.countdown = 60 // 发送验证码时间60秒
        this.startSendMessageCode = 0 // 初始化为0
        this.userInfo = {}
        this.tableData = []
        this.messageCode = ''
        this.search = {
          param: ''
        }
        this.qtype = 'csmPhone'
        this.cradType = 0
        this.$nextTick(() => {
          this.visible = false
        })

        this.visible = false
        this.btnTxt = '充值'
        this.type = null
        this.title = ''
        this.cardCode = ''
        this.csmInfo = {}
        this.phoneItems = []
        this.curtainTy = 1 // 调账类型
        this.csmPhone = '' // 变更后绑定手机号
        this.isText = true
        this.temp = {
          feeCount1: '',
          feeCount2: '0.00',
          remark: '',
          cardFee: 0,
          money: '',
          companyName: '', // 企业名称
          bankName: '', // 开户银行
          bankAccount: '', // 账户号码
          backup: '' // 备用字段
        }
        // 修改密码
        this.pas = {
          password1: '', // 原密码
          password2: '', // 新密码
          password3: '' // 再次输入的新密码
        }
        // 调账
        this.price = {
          updateCashMoney: 0.00, // 现金卡值调整
          changeCashMoney1: 0.00, // 初始数据现金卡值
          changeSendMoney1: 0.00, // 初始数据赠送卡值调整
          changeCardSurplus1: 0.00, // 初始数据调整后卡余额/余次
          updateSendMoney: 0.00, // 赠送卡值调整
          changeCashMoney: 0.00, // 调整后现金卡值
          changeSendMoney: 0.00, // 调整后赠送卡值
          changeCardSurplus: 0.00// 调整后卡余额
        }
        /* 读卡/写卡相关参数*/
        this.obj = null // 读卡器函数
        this.locked = false
        this.csmCardRWType = 0 // 0是默认状态 1是读卡状态 2是写卡状态 3是清卡状态
        this.readClass = 1
        this.writeClass = 2
        this.hasCard = false
        this.isComOpen = false
        this.icdev = -1
        this.gl_sector = 0 // 扇区 0-15扇区  总共64个扇区
        this.gl_BinBlock = 1 // 快   0-63 但0不可用
        this.gl_wantFunc = 0
        this.readerCardCode = '' // 读卡号
        this.readerIndex = 1 // 读卡第一扇区值
        this.readerStrCode = '' // 读卡第二扇区值
        this.writerCsmCard = '' // 写卡号
        this.writerNowDate = '' // 充值卡第二扇区值
        this.isGroup = false
        // 卡信息修改
        this.query = {
          useOrgId: '',
          cardFreeMoney: 0
        }
        this.isAllOrg = false
      },
      async formatInput(e) {
        if (this.type === 5) {
          this.temp.money = (e.target.value * 1).toFixed(2)
          return
        }
        if (e.target.value) {
          this.temp.feeCount1 = (e.target.value * 1).toFixed(2)
          const feeCount1 = (this.temp.feeCount1 * 100).toFixed(0)
          const res = await topUpAdministrationPrice({ feeCount1 })
          var result = res.data // 赠送金额
          if (result !== 0) {
            result = result * 1.00 / 100
            result = isNaN(result) ? '0.00' : result.toFixed(2)
          }
          // 赠送金额
          this.temp.feeCount2 = result === 0 ? 0.00 : result
          // 设置卡内余额
          this.temp.cardStatus = this.temp.feeCount1
          // 设置应收金额
          this.temp.totalPrice = (this.temp.feeCount1 * 1) + (result * 1) + (this.temp.cardFee * 1)
        }
      },
      // 请求用户信息接口
      async getUserInfo(cardCode) {
        const res = await topUpAdministrationInfoInfo({
          cardCode: cardCode
        })
        console.log('用户信息', res)
        this.csmInfo = res.data
        this.temp.companyName = res.data.companyName // 企业名称
        this.temp.bankName = res.data.bankName // 开户银行
        this.temp.bankAccount = res.data.bankAccount // 账户号码
        this.temp.backup = res.databackup

        // 初始数据
        this.price.changeCashMoney1 = this.numberFormat1(this.csmInfo.cashMoney)// 初始数据现金卡值
        this.price.changeSendMoney1 = this.numberFormat1(this.csmInfo.sendMoney)// 初始数据赠送卡值调整
        this.price.changeCardSurplus1 = this.numberFormat1(this.csmInfo.cardSurplus)// 初始数据调整后卡余额/余次
        // 调整后
        this.price.cashMoney = this.numberFormat1(this.csmInfo.cashMoney)
        this.price.changeCashMoney = this.numberFormat1(this.csmInfo.cashMoney)// 调整后现金卡值
        this.price.changeSendMoney = this.numberFormat1(this.csmInfo.sendMoney)// 调整后赠送卡值
        this.price.changeCardSurplus = this.numberFormat1(this.csmInfo.cardSurplus)// 调整后卡余额/余次
        // 查询客户状态
        var res1 = {}
        if (this.csmInfo.cardOpenStatus === 1) {
          res1 = await topUpAdministrationUserInfo({
            csmStatus: 9, // 查询状态不是已注销的客户
            csmCode: this.csmInfo.csmCode
          })
        }
        if (this.csmInfo.cardOpenStatus === 2) {
          res1 = await exactQueryGroup({
            csmStatus: 9, // 查询状态不是已注销的客户
            groupCode: this.csmInfo.csmCode
          })
        }

        console.log('客户状态', res1)
        if (res1.data && res1.data.csmStatus === 1) {
          this.$message({
            type: 'warning',
            message: '当前客户未审核'
          })
          return
        }
        if (res1.data && res1.data.csmStatus === 3) {
          this.$message({
            type: 'warning',
            message: '当前客户已挂失'
          })
          return
        }
        if (res1.data && res1.data.phoneItems && res1.data.phoneItems.length) {
          this.phoneItems = res1.data.phoneItems.filter(item => {
            return item.cpStatus === 2
          })
          if (this.phoneItems.length > 0) {
            this.csmPhone = this.phoneItems[0].csmPhone
          }
        }
      },
      // 调账冲正
      onMoney(e, is) {
        if (!e.target.value) {
          e.target.value = 0.00
          e.target.value = 0.00
        }
        if (e.target.value) {
          if (is === 'updateCashMoney') {
            if (this.curtainTy === 1) {
              this.price.updateCashMoney = (e.target.value * 1).toFixed(2)
              // 调整后现金卡值
              this.price.changeCashMoney = ((this.price.updateCashMoney * 1) + (this.price.changeCashMoney1 * 1)).toFixed(2)
              // 调整后卡余额/余次
              this.price.changeCardSurplus = ((this.price.updateCashMoney * 1) + (this.price.changeCardSurplus1 * 1) + (this.price.updateSendMoney * 1)).toFixed(2)
            } else {
              this.price.updateCashMoney = (e.target.value * 1).toFixed(2)
              // 调整后现金卡值
              this.price.changeCashMoney = ((this.price.changeCashMoney1 * 1) - (this.price.updateCashMoney * 1)).toFixed(2)
              // 调整后卡余额/余次
              this.price.changeCardSurplus = ((this.price.changeCardSurplus1 * 1) - (this.price.updateCashMoney * 1) - (this.price.updateSendMoney * 1)).toFixed(2)
            }
          } else {
            if (this.curtainTy === 1) {
              this.price.updateSendMoney = (e.target.value * 1).toFixed(2)
              // 赠送卡值调整
              this.price.changeSendMoney = ((this.price.updateSendMoney * 1) + (this.price.changeSendMoney1 * 1)).toFixed(2)
              // 调整后卡余额/余次
              this.price.changeCardSurplus = ((this.price.updateCashMoney * 1) + (this.price.changeCardSurplus1 * 1) + (this.price.updateSendMoney * 1)).toFixed(2)
            } else {
              this.price.updateSendMoney = (e.target.value * 1).toFixed(2)
              // 赠送卡值调整
              this.price.changeSendMoney = ((this.price.changeSendMoney1 * 1) - (this.price.updateSendMoney * 1)).toFixed(2)
              // 调整后卡余额/余次
              this.price.changeCardSurplus = ((this.price.changeCardSurplus1 * 1) - (this.price.updateSendMoney * 1) - (this.price.updateCashMoney * 1)).toFixed(2)
            }
          }
        }
      },
      //
      changeGroup(val) {
        this.price.updateCashMoney = 0
        if (val === 1) {
          this.price.updateCashMoney = (this.price.updateCashMoney * 1).toFixed(2)
          // 调整后现金卡值
          this.price.changeCashMoney = ((this.price.updateCashMoney * 1) + (this.price.changeCashMoney1 * 1)).toFixed(2)
          // 调整后赠送卡值
          this.price.changeSendMoney = ((this.price.updateSendMoney * 1) + (this.price.changeSendMoney1 * 1)).toFixed(2)
          // 调整后卡余额
          this.price.changeCardSurplus = ((this.price.updateCashMoney * 1) + (this.price.changeCardSurplus1 * 1) + (this.price.updateSendMoney * 1)).toFixed(2)
        } else {
          this.price.updateCashMoney = (this.price.updateCashMoney * 1).toFixed(2)
          // 调整后现金卡值
          this.price.changeCashMoney = ((this.price.changeCashMoney1 * 1) - (this.price.updateCashMoney * 1)).toFixed(2)
          // 调整后赠送卡值
          this.price.changeSendMoney = ((this.price.changeSendMoney1 * 1) - (this.price.updateSendMoney * 1)).toFixed(2)
          // 调整后卡余额
          this.price.changeCardSurplus = ((this.price.changeCardSurplus1 * 1) - (this.price.updateCashMoney * 1) - (this.price.updateSendMoney * 1)).toFixed(2)
        }
      },
      // 充值金额
      onInput(value, is) {
        let res = value
          .replace(/\.{2,}/g, '.')
          .replace(/^\./g, '')
          .replace('.', '$#$')
          .replace(/\./g, '')
          .replace('$#$', '.')
          .replace(/^0\d+|^\./g, '')
          .replace(/^(.*\..{2}).*$/, '$1')

        if (this.type === 9) {
          if (this.curtainTy === 2) {
            res = res.replace(/[^\d.]/g, '')
          }
          is === 'updateCashMoney' ? this.price.updateCashMoney = res : this.price.updateSendMoney = res
          return
        } else {
          res = res.replace(/[^\d.]/g, '')
        }
        this.temp.feeCount1 = res
        this.temp.money = res
      },
      feeCount2Input() {
        this.$refs.dataFormCharge.clearValidate()
      },
      // 初始化
      // eslint-disable-next-line no-dupe-keys
      // initCardServer() {
      //   var _this = this
      //   _this.obj = SmartReader.OBJ()
      //   _this.obj.createSocket()
      //   _this.obj.onResult(async(rData) => {
      //     console.log('进入的状态,rData.FunctionID', rData)
      //     console.log('进入的状态,rData.FunctionID', rData.FunctionID)
      //     switch (rData.FunctionID) {
      //     case FUNCIDS._fid_initialcom:
      //       var rel = Number(rData.RePara_Int)
      //       if (rel === 0) {
      //         var hdev = parseInt(rData.RePara_Str)
      //         if (hdev !== -1) {
      //           _this.icdev = hdev
      //           _this.obj.beep(_this.icdev, 10) // do a beep
      //           _this.isComOpen = true // Set reader link status
      //           // _this.readerCardCode = "";
      //           _this.LoadKey() // 验证密码
      //         } else {
      //           _this.locked = false
      //           _this.$message({
      //             type: 'warning',
      //             message: '打开读卡器失败'
      //           })
      //           return
      //         }
      //       } else {
      //         _this.locked = false
      //         _this.$message({
      //           type: 'warning',
      //           message: '打开读卡器失败'
      //         })
      //         return
      //       }
      //       break
      //     case FUNCIDS._fid_exit: // 关闭读卡器
      //       break
      //     case FUNCIDS._fid_beep: // 峰槽声
      //       break
      //     case FUNCIDS._fid_loadKey: // 校验密码
      //       if (_this.csmCardRWType === 1) { // 说明是读卡状态
      //         _this.Read()
      //       } else if (_this.csmCardRWType === 2) { // 写卡充能
      //         _this.Write()
      //       } else if (_this.csmCardRWType === 3) { // 清卡功能
      //         _this.Write()
      //       }
      //       break
      //     case FUNCIDS._fid_findCardStr: // 读取操作进入
      //       var strcard = rData.RePara_Str
      //       if (strcard !== '') {
      //         _this.hasCard = true
      //         switch (_this.gl_wantFunc) {
      //         case _this.readClass:
      //         case _this.writeClass:
      //           _this.obj.authentication(_this.icdev, 0, _this.gl_sector)
      //           break
      //         }
      //       } else {
      //         _this.$message({
      //           type: 'warning',
      //           message: '充值设备连接异常，请联系管理员'
      //         })
      //         _this.locked = false
      //         _this.CloseCsmcard()
      //         return
      //       }
      //       break
      //     case FUNCIDS._fid_authenClass: // 读取
      //       var rel1 = Number(rData.RePara_Int)
      //       if (rel1 === 0) {
      //         switch (_this.gl_wantFunc) {
      //         case _this.readClass: // 读卡号
      //           // 读取卡号
      //           if (_this.readerIndex === 1) {
      //             _this.obj.read(_this.icdev, _this.gl_BinBlock)
      //             // 读取卡第二扇区值
      //           } else if (_this.readerIndex === 2) {
      //             _this.obj.read(_this.icdev, 2)
      //           }

      //           break
      //         case _this.writeClass: // 写卡号
      //           var params = {
      //             readerCardCode: _this.readerCardCode,
      //             readerStrCode: _this.readerStrCode,
      //             cardCode: _this.csmInfo.cardCode,
      //             cardStrCode: _this.writerNowDate,
      //             remark: this.temp.remark
      //           }
      //           console.log('....换卡入餐', params)
      //           try {
      //             var res = await topUpAdministratioTradeCrad(params)
      //             console.log('....换卡出餐', res)
      //             _this.locked = false
      //             _this.CloseCsmcard()
      //             this.$message({
      //               type: 'success',
      //               message: '换卡成功！'
      //             })
      //           } catch (error) {
      //             _this.locked = false
      //             _this.CloseCsmcard()
      //             // _this.obj.write(_this.icdev, _this.gl_BinBlock, _this.writerCsmCard)
      //             // 写入第二扇区值
      //             // _this.obj.write(_this.icdev, 2, _this.writerNowDate)
      //           }
      //           break
      //         }
      //       } else {
      //         _this.$message({
      //           type: 'warning',
      //           message: '充值设备连接异常，请联系管理员'
      //         })
      //         _this.locked = false
      //         _this.CloseCsmcard()
      //         return
      //       }
      //       break
      //     case FUNCIDS._fid_readAsStr: // 输出读取的卡号
      //       var data = rData.RePara_Str
      //       if (data !== '') {
      //         if (_this.readerIndex === 1) {
      //           _this.readerCardCode = data
      //           // 处理卡号
      //           if (_this.readerCardCode === '') {
      //             _this.$message({
      //               type: 'warning',
      //               message: '读取卡号失败'
      //             })
      //             _this.locked = false
      //             _this.CloseCsmcard()
      //             return
      //           }

      //           var strArr = _this.readerCardCode.split('')
      //           var newCardCode = ''
      //           for (var x = 0; x < strArr.length; x++) {
      //             if (strArr[x] !== 'A') {
      //               newCardCode = newCardCode + strArr[x]
      //             }
      //           }
      //           _this.readerCardCode = newCardCode
      //           console.log('读取的卡号_this.readerCardCode', _this.readerCardCode)
      //           _this.CloseCsmcard()
      //           // 读取老卡第二扇区值
      //           _this.readerCardInfo(2)
      //           // 读取第二扇区值
      //         } else if (_this.readerIndex === 2) {
      //           _this.readerStrCode = data
      //           console.log('第二三区的值_this.readerStrCode', _this.readerStrCode)
      //           // 读取完成第二扇区随机数,将readerIndex值设置成默认值
      //           _this.readerIndex = 1
      //           _this.CloseCsmcard()
      //           // 写入卡片
      //           _this.writerCardCode()
      //         }
      //       } else {
      //         _this.$message({
      //           type: 'warning',
      //           message: '充值设备连接异常，请联系管理员'
      //         })
      //         _this.locked = false
      //         _this.CloseCsmcard()
      //         return
      //       }
      //       break
      //     case FUNCIDS._fid_writeAsStr: // 输出写入的卡号
      //       var iRet = Number(rData.RePara_Int)
      //       if (iRet === 0) {
      //         // 写入卡片成功
      //         _this.CloseCsmcard()
      //       } else {
      //         _this.$message({
      //           type: 'warning',
      //           message: '写入卡片失败'
      //         })
      //         _this.locked = false
      //         _this.CloseCsmcard()
      //         return
      //       }
      //       break
      //     }
      //   })
      // },

      // 读取第二扇区值
      readerCardInfo(index) {
        var _this = this
        _this.csmCardRWType = 1// 设置读卡器状态为读卡状态
        _this.readerIndex = index
        _this.OpenCsmcard() // 打开读卡器
      },
      /** 写入卡片**/
      writerCardCode() {
        var _this = this
        // 获取卡编号
        var cardCode = _this.csmInfo.cardCode
        var cardCodeLength = cardCode.length
        var forLength = 32 - cardCodeLength
        for (var x = 0; x < forLength; x++) {
          cardCode = cardCode + 'a'
        }
        _this.writerCsmCard = cardCode
        // 当前办卡时间戳
        var dateTime = Date.now() + ''
        var forDateTimeLength = 32 - dateTime.length
        for (var a = 0; a < forDateTimeLength; a++) {
          dateTime = dateTime + 'b'
        }
        _this.writerNowDate = dateTime
        _this.csmCardRWType = 2// 设置读卡器状态为写卡状态
        _this.OpenCsmcard() // 打开读卡器
      },
      // 充值金额
      numberFormat1: function(val) {
        val = val * 1.00 / 100
        val = Number(val)
        val = isNaN(val) ? '0.00' : val.toFixed(2)
        return val
      },
      groupCheck(selection, row) {
        console.log(selection, row, '-----1---')
        this.groupSelection = selection
        this.groupSelectHandle()
      },
      groupCheckAll(selection) {
        console.log(selection, '------2--')
        this.groupSelection = selection
        this.groupSelectHandle()
      },
      groupSelectHandle() {
        const f = this.groupSelection.some(item => item.cardSurplus < 0)
        if (f) {
          this.$message.warning('关联客户信息勾选存在充值卡为负的用户，需要先充值补交欠款才能使用总卡余额')
          this.groupSelection = this.groupSelection.filter(item => !(item.cardSurplus < 0))
          this.$refs.groupTable.clearSelection()
          this.groupSelection.forEach(item => {
            this.$refs.groupTable.toggleRowSelection(item, true)
          })
        }
      }
    }
  }
</script>

<style lang="scss" scoped>
.item {
  margin-bottom: 30px;
  .title {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    .title-icon {
      display: inline-block;
      width: 4px;
      height: 18px;
      margin-right: 6px;
      background: #01999f;
    }
    .title-text {
      font-family: Microsoft YaHei, Microsoft YaHei-Bold;
      font-size: 14px;
      font-weight: 700;
      color: #01999f;
    }
  }
  &:last-child {
    margin-bottom: 0;
  }
  .content {
    margin-bottom: 30px;
  }
  .form {
    display: flex;
    flex-wrap: wrap;
    & /deep/ .el-form-item {
      display: flex;
      width: 50%;
      padding-right: 10px;
      .el-form-item__content {
        width: 100%;
      }
    }

    /deep/.el-form-item__content {
      margin-left: 10px !important;
    }
    span {
      margin-left: 6px;
      span {
        font-size: 14px;
        color: red;
      }
    }
  }
}
.remark-changecard {
  /deep/.el-form-item__content {
    width: 80%;
  }
}
.change-cardfee {
  width: 50% !important;
}
.table-list {
  width: 100%;
  height: 200px;
  overflow: auto;
  /deep/ .has-gutter {
    .el-checkbox {
      display: none;
    }
  }
}
.cardForm {
  /deep/ .el-form-item__label {
    padding-left: 0;
  }
}
.csmInfo {
  p {
    display: flex;
    margin-bottom: 10px;
    span {
      display: block;
    }
    span:nth-child(1) {
      width: 84px;
      margin-right: 50px;
      color: #01999f;
    }
    span:nth-child(2) {
      color: red;
      flex: 1;
    }
  }

  width: 100%;
  .group-list {
    margin-bottom: 10px;
  }
}
</style>
